<template>
  <div class="rigths-container">
    <!-- 面包屑 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片面板 -->
    <el-card class="box-card">
      <!-- 表格 -->
      <el-table :data="tableData" style="width: 100%" border>
        <el-table-column type="index" width="50" label="#"></el-table-column>
        <el-table-column prop="authName" label="权限名称" width="500"></el-table-column>
        <el-table-column prop="path" label="路径" width="500"></el-table-column>
        <el-table-column label="权限等级">
          <template slot-scope="scoped">
            <el-tag v-if="scoped.row.level==0">一级</el-tag>
            <el-tag v-else-if="scoped.row.level==1" type="success">二级</el-tag>
            <el-tag v-else type="warning">三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>
           
<script>
import { rights_api } from "@/api";
export default {
  data() {
    return {
      // 表格数据
      tableData: [],
    };
  },
  created() {
    this.getTable();
  },
  methods: {
    //获取后台数据
    async getTable() {
      //发送请求
      const { data: res } = await rights_api("list");
      // console.log(res);
      this.tableData = res.data;
    },
  },
};
</script>
<style scoped lang="less">
.rigths-container {
  .el-breadcrumb {
    margin-bottom: 20px;
  }
}
</style>